﻿using System;
using System.Windows.Forms;
using System.Collections.Generic;

namespace Personalplaner.Modules.Dienstplan.Print
{
	public class GridPrint : IGridParameters
	{
		IGridPrintDocument PrintDocument;

		int abteilungID = 0;
		/// <summary>
		/// Abteilung to be printed, 0 if all should be printed
		/// </summary>
		public int AbteilungID
		{
			get
			{
				return abteilungID;
			}
			set
			{
				abteilungID = value;
			}
		}

		DataGridView mainGrid;
		public DataGridView MainGrid
		{
			get
			{
				return mainGrid;
			}
			set
			{
				mainGrid = value;
			}
		}

		DataGridView timeGrid;
		public DataGridView TimeGrid
		{
			get
			{
				return timeGrid;
			}
			set
			{
				timeGrid = value;
			}
		}

		int pageSize;
		public int PageSize
		{
			get
			{
				return pageSize;
			}
			set
			{
				pageSize = value;
			}
		}

        bool preview;
        public bool Preview
        {
            get
            {
                return preview;
            }
            set
            {
                preview = value;
            }
        }

		Gencode.PrsCommon.Data.Plan.Grid gridData;
		public Gencode.PrsCommon.Data.Plan.Grid GridData
		{
			get
			{
				return gridData;
			}
			set
			{
				gridData = value;
			}
		}

		public List<DataGridView> Grids
		{
			get
			{
				return PrintDocument.Grids;
			}
		}

		public int GridHeight
		{
			get
			{
				return PrintDocument.GridHeight;
			}
		}

		public void CreatePrinteableGrids()
		{
			if (AbteilungID == 0)
				PrintDocument = new GridPrintDocument(this);
			else
				PrintDocument = new AbteilungGridPrintDocument(this);

			PrintDocument.PrintGrids();
		}
	}
}
